{% extends '../temp_base.html' %}

{% block local_header_css_js %}
  <!-- DataTables -->
  <link rel="stylesheet" href="{{HTML_URL_BASE}}/plugins/datatables/dataTables.bootstrap.css">

{% end %}

{% block content %}
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Update Host
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li><a href="#">Resource Management</a></li>
        <li class="active">Update Host</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <!-- add content for Host -->
        <div class="col-md-8">
          <!-- Horizontal Form -->
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title">Host Information</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start group -->
            <form class="form-horizontal" action="../saveobject" method="post">
              <div class="box-body">
                <div class="form-group">
                  <label for="txt_host_ip" class="col-sm-2 control-label">Host IP</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="txt_host_ip" name="host_ip" placeholder="Enter ..." value="{{host.ip}}">
                    <input type="hidden" name="host_id" value="{{host.id}}">
                    <input type="hidden" name="act_type" value="update_host">
                  </div>
                </div>
                <div class="form-group">
                  <label for="txt_host_otherips" class="col-sm-2 control-label">Other IPs</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="txt_host_otherips" name="host_otherips" placeholder="Enter ..." value="{{host.otherips}}">
                  </div>
                </div>
                <div class="form-group">
                  <label for="txt_host_name" class="col-sm-2 control-label">Host Name</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="txt_host_name" name="host_hostname" placeholder="Enter ..." value="{{host.name}}">
                  </div>
                </div>
                <div class="form-group">
                  <label for="txt_host_servertype" class="col-sm-2 control-label">Server Type</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="txt_host_servertype" name="host_servertype" placeholder="Enter ..." value="{{host.servertype}}">
                  </div>
                </div>
                <div class="form-group">
                  <label for="sel_host_ostype" class="col-sm-2 control-label">OS Type</label>
                  <div class="col-sm-10">
                    <select id="sel_host_ostype" name="host_ostype" class="form-control">
                      <option value=""></option>
                      <option value="Linux"{% if host.ostype=='Linux' %} selected{%end%}>Linux</option>
                      <option value="Linux Redhat"{% if host.ostype=='Linux Redhat' %} selected{%end%}>Linux Redhat</option>
                      <option value="Linux CentOS"{% if host.ostype=='Linux CentOS' %} selected{%end%}>Linux CentOS</option>
                      <option value="Linux Oracle"{% if host.ostype=='Linux Oracle' %} selected{%end%}>Linux Oracle</option>
                      <option value="AIX"{% if host.ostype=='AIX' %} selected{%end%}>AIX</option>
                      <option value="Windows"{% if host.ostype=='Windows' %} selected{%end%}>Windows</option>
                      <option value="Windows 2008"{% if host.ostype=='Windows 2008' %} selected{%end%}>Windows 2008</option>
                      <option value="Windows 2012"{% if host.ostype=='Windows 2012' %} selected{%end%}>Windows 2012</option>
                      <option value="other">other</option>
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label for="sel_host_dc" class="col-sm-2 control-label">Select Data Center</label>
                  <div class="col-sm-10">
                    <select id="sel_host_dc" name="host_datacenter" class="form-control">
                      <option></option>
                      {% for dc in dc_list %}
                      <option value="{{dc.id}}"{% if host.datacenter and host.datacenter.id %} selected{%end%}>{{dc.name}}</option>
                      {% end %}
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label for="ckbox_host_enabled" class="col-sm-2 control-label">&nbsp;</label>
                  <div class="col-sm-10">
                    <div class="checkbox">
                      <label><input id="ckbox_host_enabled" name="host_enabled" type="checkbox" {% if host.enabled == 1 %}checked{%end%}> Enabled</label>
                    </div>
                  </div>
                </div>
              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <button type="submit" class="btn btn-info pull-right">Update Host</button>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
          <!-- /.box -->
        </div>
        <!--/.add content for Host-->   
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
{% end %}

{% block local_footer_css_js %}
<!-- DataTables -->
<script src="{{HTML_URL_BASE}}/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="{{HTML_URL_BASE}}/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="{{HTML_URL_BASE}}/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="{{HTML_URL_BASE}}/plugins/fastclick/fastclick.js"></script>
<!-- page script -->
<script>
  $(function () {
    $("#example1").DataTable();
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false
    });
    
    $("#btn_create_user").click(function(){
        window.location.href='addgroup';
    });
  });
</script>
{% end %}
